var productid=localStorage.getItem('productid')
let xhr1=new XMLHttpRequest()
var xiangqing=document.querySelector('.xiangqing')
xhr1.open('get',`http://chst.vip:1234/api/getdiscountproduct?productid=${productid}`,true,)
xhr1.onload=function(){

    if(xhr1.status===200){
        var res2=JSON.parse(xhr1.responseText)
         console.log(res2.result)
    let regExp = /^<[^<]+\s+src="([^''""]*)"/;

         var lis2=''

         res2.result.forEach(function(so,ind){
         let tu = res2.result[ind].productImg.match(regExp)[1];
    //    console.log(tu)
        lis2+=`
        <h4>${so.productName}</h4>
        
        <span>${so.productPrice}</span>
        <span>${so.productFrom}</span>
        <span>${so.productTime}</span>
        <span>${so.productTips}</span>
        <p>${so.productInfo}</p>
        <img src="${tu}">
        <button>前往购买</button>

        <div class="pinglunqu">${so.productComment}</div>
       
       `
    })
  xiangqing.innerHTML=lis2
}
   
}
   
xhr1.send(null)
$('.icon-zuojiantou1').click(function(){
  location.href="./国内折扣.html"
})

$('.bot span:nth-of-type(3)').click(function(){

  document.documentElement.scrollTop = 0

})


